﻿
Partial Class MoreDetails
    Inherits System.Web.UI.UserControl

    Public Property DetailControl() As String
        Get
            Return ViewState("DetailControl")
        End Get
        Set(ByVal value As String)
            ViewState("DetailControl") = value
        End Set
    End Property


    Public Property DetailControlParameter() As String
        Get
            Return ViewState("DetailControlParameter")
        End Get
        Set(ByVal value As String)
            ViewState("DetailControlParameter") = value
        End Set
    End Property


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If pchDetail.Visible = True Then
            AddControl()
        End If
    End Sub

    Protected Sub lnkMoreInfo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkMoreInfo.Click
        pchDetail.Visible = True
        AddControl()
    End Sub

    Private Sub AddControl()
        Try
            If pchDetail.Controls.Count = 0 Then
                Dim ctl As DnnSecurity.DetailControl = LoadControl(DetailControl + ".ascx")
                ctl.DetailControlParameter = DetailControlParameter
                pchDetail.Controls.Add(ctl)
                lnkRefresh.Visible = True
                lnkMoreInfo.Visible = False
            End If

        Catch ex As Exception
            pchDetail.Controls.Add(New LiteralControl(ex.Message))
        End Try
    End Sub
End Class
